<%--
<!------------------------------------------------------------------------------
 - Copyright 2005 CORE Solutions Limited
 - All rights reserved.
 - PROPRIETARY AND CONFIDENTIAL INFORMATION.
 - Use is subject to license terms.
 -
 - FUNCTION ID      :   TASK
 - AUTHOR           :   Ric Yik 
 - DATE CREATE      :   2005/12/29
 - DESCRIPTION      :   a SEARCH CONTENT JSP file for the function, TASK
 -                  :   
 -                  :   
 -                  :   
 -
 - MODIFICATION HISTORY:
 - DATE         AUTHOR          VERSION NO.         COMMENT
 - -----------  --------------  ------------------  -------------------
 - 2005/12/29   Ric Yik         1.0                 source is generated.
 -
 -
 -
------------------------------------------------------------------------------->

--%>
<%@ include file="/jsp/com/erp/app/common/jsp/directives_include.jsp"%>

<%@ page import="com.erp.app.setup.taskMaster.vo.TaskHdrVo"%>
<%@ page import="com.erp.app.setup.taskMaster.web.TaskSearchAction"%>

<%@ include file="/jsp/com/erp/app/common/jsp/html_include.jsp"%>

<jsp:useBean id="taskSearchForm" scope="session" type="com.erp.app.setup.taskMaster.web.TaskSearchForm" />

<%
ArrayList taskList = taskSearchForm.getResultList();
pageContext.setAttribute("taskList", taskList);
TableSchema ts = taskSearchForm.getTs();
%>

<script language="javascript">

	function doLoad() {
		<%
		if (CommonUtil.nullToString((String)session.getAttribute(ProjectConstants.SESSION_ALERT_AFTER_SAVE)).equals(ProjectConstants.GENERIC_YES)) {
			session.removeAttribute(ProjectConstants.SESSION_ALERT_AFTER_SAVE);
			out.println("alert('Records saved.');");
		}
		%>
	}

	function doEdit(val) {
		document.forms[0].editDocType.value = val;
		doSubmit('<%=taskSearchForm.ACTION_EDIT%>');
	}

</script>

<body onLoad="javascript:doLoad();autofill_init();">
<html:form action="/taskSearch">

<html:hidden property="pageEvent"/>
<html:hidden property="pageMode"/>
<html:hidden property="deleteIdx"/>
<html:hidden property="editDocType"/>

<table class="table_top">

<tr>
	<td>
		<chtml:button form="taskSearchForm" pageEvent="<%=TaskSearchAction.ACTION_EXIT%>"
			styleClass="button1"/>
		<chtml:button form="taskSearchForm" pageEvent="<%=TaskSearchAction.ACTION_SEARCH%>"
			styleClass="button1"/>
		<chtml:button form="taskSearchForm" pageEvent="<%=TaskSearchAction.ACTION_CLEAR%>"
			styleClass="button1"/>
	</td>
</tr>

<tr>
	<td>
		<table class="table_crit_short">
		<tr>
		    <td class="col_label">
				<html:text useExtensions="true" uiType="label" property="srchDocTypeFr" />
			</td>
			<td class="col_value">
				<html:text useExtensions="true" uiType="combobox" property="srchDocTypeFr" showCode="false" />
			</td>
		</tr>
		<tr>
			<td class="col_label">
				<html:text useExtensions="true" uiType="label" property="srchDocDescFr" />
			</td>
			<td class="col_value">
				<html:text useExtensions="true" uiType="text" property="srchDocDescFr" />
			</td>
		</tr>
		</table>
	</td>
</tr>
<tr>
     <td><font color='red'><html:errors/></font></td>
</tr>
<td>
<table class="table_short_grid">
<tr>
	<td class="grid_page">
	<%if (taskSearchForm.getTotalPage() == 0 ) {%>
		&nbsp;
	<%} else {%>
		<input type="button" value="Go" class="button1" onClick="javascript:doSubmit('<%=taskSearchForm.ACTION_SCROLL_TO%>');" >
		Page
		<html:text property="scrollTo" styleClass="textbox1" readonly="<%=rowReadOnly%>" maxlength="4" size="4" value="<%=String.valueOf(taskSearchForm.getCurrentPage())%>"/>
		of <%=taskSearchForm.getTotalPage()%>
	<%}%>
		<input type="button" value="|&lt;&lt;" class="button1" onClick="javascript:doSubmit('<%=taskSearchForm.ACTION_TO_FIRST_PAGE%>');" <%=taskSearchForm.getSidx() == 0 ? "disabled" : ""%>>
		<input type="button" value="&lt;&lt;" class="button1" onClick="javascript:doSubmit('<%=taskSearchForm.ACTION_SCROLL_LEFT%>');" <%=taskSearchForm.getSidx() == 0 ? "disabled" : ""%>>
		<input type="button" value="&gt;&gt;" class="button1" onClick="javascript:doSubmit('<%=taskSearchForm.ACTION_SCROLL_RIGHT%>');" <%=taskSearchForm.getSidx() < Integer.parseInt(taskSearchForm.getLastPageSidx()) ? "" : "disabled"%>>
		<input type="button" value="&gt;&gt|" class="button1" onClick="javascript:doSubmit('<%=taskSearchForm.ACTION_TO_LAST_PAGE%>');" <%=taskSearchForm.getSidx() < Integer.parseInt(taskSearchForm.getLastPageSidx()) ? "" : "disabled"%>>
	</td>
</tr>
</table>
</td>
</table>

<table class="table_short_grid">

	<tr class="grid_header">
		<td class="grid_header_col" nowrap>
			<html:text useExtensions="true" uiType="label" childTsIndex="current" property="lblGridDocType" />
		</td>
		<td class="grid_header_col" nowrap>
			<html:text useExtensions="true" uiType="label" childTsIndex="current" property="lblGridDocDesc" />
		</td>
	</tr>
	
	<logic:iterate id="srchRsltRow" name="taskList" indexId="idx" length="<%=String.valueOf(ProjectConstants.MAX_DISPLAY)%>" offset="<%=String.valueOf(taskSearchForm.getSidx())%>">
		
		<%
		    TaskHdrVo row = (TaskHdrVo) srchRsltRow;
		    String gridStyle = (idx.intValue()%2 == 0) ? "grid_result1" : "grid_result2";
		%>
		
		<% if (row != null) {%>
		<tr class="<%=gridStyle%>" onmouseover="mouseOverHighlight(event,'grid_row_action_hilite')"
		onmouseout="mouseOutHighlight('<%=gridStyle%>')"
		onclick="javascript:doEdit('<%=StringUtil.escapeSlash(row.getDocType(), "'") %>')">
			<td class="grid_outline" nowrap><html:text useExtensions="true" uiType="write" name="srchRsltRow" property="docType" filter="true"/></td>
			<td class="grid_outline" nowrap><html:text useExtensions="true" uiType="write" name="srchRsltRow" property="docDesc" filter="true"/></td>
		</tr>
		
		<% }%>
		
	</logic:iterate>
</table>

</html:form>
